package com.health.tools;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Nation {
	private static Map<String, String> nationMap = new TreeMap<String, String>();

	static {
		nationMap.put("01", "汉族");
		nationMap.put("02", "蒙古族");
		nationMap.put("03", "回族");
		nationMap.put("04", "藏族");
		nationMap.put("05", "维吾尔族");
		nationMap.put("06", "苗族");
		nationMap.put("07", "彝族");
		nationMap.put("08", "壮族");
		nationMap.put("09", "布依族");
		nationMap.put("10", "朝鲜族");
		nationMap.put("11", "满族");
		nationMap.put("12", "侗族");
		nationMap.put("13", "瑶族");
		nationMap.put("14", "白族");
		nationMap.put("15", "土家族");
		nationMap.put("16", "哈尼族");
		nationMap.put("17", "哈萨克族");
		nationMap.put("18", "傣族");
		nationMap.put("19", "黎族");
		nationMap.put("20", "傈僳族");
		nationMap.put("21", "佤族");
		nationMap.put("22", "畲族");
		nationMap.put("23", "高山族");
		nationMap.put("24", "拉祜族");
		nationMap.put("25", "水族");
		nationMap.put("26", "东乡族");
		nationMap.put("27", "纳西族");
		nationMap.put("28", "景颇族");
		nationMap.put("29", "柯尔克孜族");
		nationMap.put("30", "土族");
		nationMap.put("31", "达斡尔族");
		nationMap.put("32", "仫佬族");
		nationMap.put("33", "羌族");
		nationMap.put("34", "布朗族");
		nationMap.put("35", "撒拉族");
		nationMap.put("36", "毛南族");
		nationMap.put("37", "仡佬族");
		nationMap.put("38", "锡伯族");
		nationMap.put("39", "阿昌族");
		nationMap.put("40", "普米族");
		nationMap.put("41", "塔吉克族");
		nationMap.put("42", "怒族");
		nationMap.put("43", "乌孜别克族");
		nationMap.put("44", "俄罗斯族");
		nationMap.put("45", "鄂温克族");
		nationMap.put("46", "德昂族");
		nationMap.put("47", "保安族");
		nationMap.put("48", "裕固族");
		nationMap.put("49", "京族");
		nationMap.put("50", "塔塔尔族");
		nationMap.put("51", "独龙族");
		nationMap.put("52", "鄂伦春族");
		nationMap.put("53", "赫哲族");
		nationMap.put("54", "门巴族");
		nationMap.put("55", "珞巴族");
		nationMap.put("56", "基诺族");
	}

	public static List<String> getNationNames() {
		List<String> names = new ArrayList<String>();
		Set<String> set = nationMap.keySet();
		for (String key : set) {
			names.add(nationMap.get(key));
		}
		return names;
	}

	public static String[] getNationNamesArr() {
		String arr[] = new String[56];
		List<String> names = new ArrayList<String>();
		Set<String> set = nationMap.keySet();
		for (String key : set) {
			names.add(nationMap.get(key));
		}
		return names.toArray(arr);
	}

	public static String getNationKey(String name) {
		Set<String> set = nationMap.keySet();
		for (String key : set) {
			if (nationMap.get(key).equals(name)) {
				return key;
			}
		}
		return "";
	}

	/**
	 * 通过key获取民族名称
	 * 
	 * @param key
	 * @return
	 * @author 鹿云族
	 * @date 2016族6族2族 上午9:44:27
	 */
	public static String getNationName(String key) {
		if (key == null) {
			return "";
		}
		key = key.replace(" ", "");
		if (nationMap.containsKey(key)) {
			return nationMap.get(key);
		} else {
			return "";
		}
	}
}
